package com.dinglian.ots.result;

public class CodeMsg {

    private int code;
    private String msg;

    //通用的错误码
    public static CodeMsg SUCCESS = new CodeMsg(0, "success");
    public static CodeMsg SUCCESS2 = new CodeMsg(200, "操作成功！请返回！");
    public static CodeMsg SERVER_ERROR = new CodeMsg(500100, "操作失败请重试");
    public static CodeMsg BIND_ERROR = new CodeMsg(500101, "参数校验异常：%s");
    public static CodeMsg FILE_FORMAT_ERROR = new CodeMsg(500102, "文件格式有误");
    public static CodeMsg DELETE_FILE_ERROR = new CodeMsg(500103, "删除文件失败");
    public static CodeMsg CODE_EXPIRED = new CodeMsg(500104, "验证码过期");
    public static CodeMsg CODE_ERROR = new CodeMsg(500105, "验证码错误");
    public static CodeMsg INVALID_SESSION_TOKEN = new CodeMsg(500106, "无效的sessionToken");
    public static CodeMsg USER_NOT_LOGIN = new CodeMsg(500107, "您已在别处登录，请重新登录");
    public static CodeMsg USER_OUT_LOGIN = new CodeMsg(500108, "您已在另一台设备上登录");
    public static CodeMsg TO_BUYER_LOGIN = new CodeMsg(500109, "请切换至买手端登录");
    public static CodeMsg TO_BRAND_LOGIN = new CodeMsg(500110, "请切换至品牌端登录");
    public static CodeMsg TO_ADMIN_LOGIN = new CodeMsg(500111, "请切换至管理员端登录");


    public static CodeMsg USER_ID_NOT_FOUND = new CodeMsg(500006, "未查到对应的用户ID");
    public static CodeMsg NOT_ELECTION_ORDER = new CodeMsg(500007, "没有查询到选款单");
    public static CodeMsg BRAND_NAME_IS_EXIST = new CodeMsg(500008, "品牌名称已存在");
    public static CodeMsg BRAND_EXPIRATION = new CodeMsg(500109, "品牌已过期");
    public static CodeMsg BRAND_IS_NOT_EXIST = new CodeMsg(500110, "品牌不存在");
    public static CodeMsg STYLENAME_IS_EXIST = new CodeMsg(500111, "款色编码%s已存在");
    public static CodeMsg BRAND_IS_NOT_FOUND = new CodeMsg(500112, "未查询到该品牌信息");
    public static CodeMsg BRAND_INFO_IS_NOT_FOUND = new CodeMsg(500113, "请先选择品牌");
    public static CodeMsg SKU_IS_EXIST = new CodeMsg(500114, "存在相同的尺码");
    public static CodeMsg COLOR_ERROR = new CodeMsg(500115, "颜色%s不存在");
    public static CodeMsg CATEGORY_ERROR = new CodeMsg(500116, "品类%s不存在");
    public static CodeMsg SIZE_ERROR = new CodeMsg(500117, "尺寸%s不存在");
    public static CodeMsg SEASON_ERROR = new CodeMsg(500118, "季节%s不存在");
    public static CodeMsg CART_IS_EXIST = new CodeMsg(500119, "季节%s不存在");
    public static CodeMsg PRODUCT_ID_LIST_NULL = new CodeMsg(500120, "请选择商品");
    public static CodeMsg LESS_THAN_MINIMUM_ORDER_QTY1 = new CodeMsg(500121, "未满足最小起订量");
    public static CodeMsg LESS_THAN_MINIMUM_ORDER_QTY = new CodeMsg(500121, "未满足%s最小起订量");
    public static CodeMsg LESS_THAN_MINIMUM_BRAND_QTY = new CodeMsg(500122, "未满足品牌最小起订量");
    public static CodeMsg LESS_THAN_MINIMUM_BRAND_QTY1 = new CodeMsg(500122, "不满足品牌:%s最小起订量");
    public static CodeMsg BRAND_IS_NOT_PASS = new CodeMsg(500123, "当前品牌未通过您的审核");
    public static CodeMsg EXCEL_NO_DATA = new CodeMsg(500601, "没有数据导出");
    public static CodeMsg EXCEL_FIELD_NO_DATA = new CodeMsg(500602, "%s没有数据");
    public static CodeMsg PRODUCT_IS_NULL = new CodeMsg(500603, "商品不存在");
    public static CodeMsg BRAND_QTY = new CodeMsg(500604, "品牌起订量格式错误");
    public static CodeMsg MESSAGE_OWN = new CodeMsg(500605, "请勿查看他人的站内信");
    public static CodeMsg DONT_TOUCH_ME = new CodeMsg(500606, "无下载权限");

    public static CodeMsg NO_ROLE = new CodeMsg(500500, "您暂时没有该角色权限，请重新登录！");
    public static CodeMsg ACCOUNT_IS_NOT_ENABLE = new CodeMsg(500505, "该账户已停用！");
    public static CodeMsg USERNAME_IS_NOT_EXIST = new CodeMsg(500506, "用户名不存在！");
    public static CodeMsg MOBILE_IS_NOT_EXIST = new CodeMsg(500506, "手机号不存在！");
    public static CodeMsg PASSWORD_ERROR = new CodeMsg(500507, "密码错误！");

    public static CodeMsg PASSWORD_IS_SAME = new CodeMsg(500501, "新密码不能与旧密码相同");
    public static CodeMsg USERNAME_IS_EXIST = new CodeMsg(500502, "手机号已存在");
    public static CodeMsg NO_SETTING_AUTH = new CodeMsg(500503, "没有设置权限");
    public static CodeMsg ROLE_NAME_IS_EXIST = new CodeMsg(500504, "角色名已存在");


    private CodeMsg() {
    }

    private CodeMsg(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public CodeMsg fillArgs(Object... args) {
        int code = this.code;
        String message = String.format(this.msg, args);
        return new CodeMsg(code, message);
    }

    @Override
    public String toString() {
        return "CodeMsg [code=" + code + ", msg=" + msg + "]";
    }


}
